package thread;

//1、创建一个继承Thread类的子类
class MyThread extends Thread {

    //2、重写Thread类中的run()方法
    @Override
    public void run(){
        for (int i = 0 ; i <= 1000 ; i++ ){
            System.out.print( MyThread.currentThread().getName()  + " : z" +i +  (i % 10 == 0 ? "\n" :  "    " ) );
        }
    }

}
public class ThreadTest {
    public static void main(String[] args) {
        //3、创建继承Thread类的子类实例对象
        MyThread t1 = new MyThread();
        //4、调用start()方法
        t1.start();


    }
}
